<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<s:if test="userDetial.username!=''">
<s:property value="userDetial.username"/>
</s:if>
<s:else>
<s:property value="userDetial.eusername"/>
</s:else>
</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/tools/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/tags.js"></script>
<script type="text/javascript" src="js/times.js"></script>
<script type="text/javascript" src="js/toupiao.js"></script>
<style type="text/css">
		    .sort ul li a{font-weight:bold;padding-left:5px;text-decoration: none;display:block;}
            .sort ul li a:hover {font-weight:bold;text-decoration:none;background-color:#982987;color:#FFFFFF;}
</style>
<script type="text/javascript">
   var keylis = new Array(<s:property value="userDetial.tags" escape="false" />);
   $(document).ready(function(){
            var sort='<s:property value="sort"/>'
             if(sort!="")
             {
               $("#sort").val(sort);
             }
            
		  
		  
			$("#keyword").keyup(function(event){
			var myEvent = event||window.event;
			 var keyCode = myEvent.keyCode;
		      search(keyCode);
			})
			.keydown(function(event){
				     if($("#keyword").val()=="我要搜索")
				     {
				       $("#keyword").val("");
				     }
			})
			.focus(function(){
			     if($("#keyword").val()=="我要搜索")
				     {
				       $("#keyword").val("");
				     }
			})
			.blur(function(){
			     if($("#keyword").val()=="")
				     {
				       $("#keyword").val("我要搜索");
				     }
			});
		   });
		   function search(keyCode)
		   {
				   if(keyCode==13)
				   {
				   	  var keyword=$("#keyword").val();
					  if(keyword!="")
					  {
					  	window.location.href="user!groupbyUserPage.action?currentPage=1&userId=<s:property value="userDetial.userId"/>&keyword="+$.trim($("#keyword").val());
					  }else
					  {
					  	window.location.href="user!groupbyUserPage.action?currentPage=1&userId=<s:property value="userDetial.userId"/>";
					  }
				   }
		   }
   function sort()
   {
        var sort =$("#sort").val();
        if(sort!="")
        {
        window.location.href="user!groupbyUserPage.action?currentPage=1&userId=<s:property value="userDetial.userId"/>&sort="+sort;
        }
   }
   function addFriend(userId)
		 {
		 if(ProductVote("groupbyUser"+userId))
	      {
		    $.post("groupbyajax/user!addFriend.action",{userId:userId,flag:6},function(data){
		        
		        
		         if(data.success==true)
		         {
		            alert("关注成功！");
		         }else if(data.success=="error")
		         {
		          delCookie("sigleUser"+userId);
		           alert("不能关注自己！");
		         }else if(data.success==false)
		         {
		          delCookie("sigleUser"+userId);
		           alert("已经关过！");
		         }else
		         {
		          delCookie("sigleUser"+userId);
		            alert("请登录！");
		         }
		    });
		    }
		 }
</script>
</head>

<body>
<div class="container">
<jsp:include page="../head.jsp"/> 
<div class="ge"></div>
<div class="content">
<div class="wrap">
         <div class="left">
	         <div class="word">
			      <div class="word_top"><a  target="_parent"><s:property value="userDetial.username"/>提供的关键词</a>
				  </div>
				  <div class="word_con">
				    <s:iterator value="userDetial.tags.replaceAll('\"','').split(',')" id="tag" status="status">
				      <a href="groupby!getCityGroupbyList.action?cityId=<s:property value="#session.cityId"/>&userId=<s:property value="userId"/>&currentPage=1&keyword=<s:property value="tag"/>,0" style="letter-spacing:4px;margin:5px;"><s:property value="tag"/></a>
				    </s:iterator>
				  </div>
			 </div>   
			 
		<div class="jiansuo">
		     <div class="jiansuo_top">
		     <ul>
		     <li>
		     <a href="user!groupbyUserPage.action?currentPage=1&userId=${userId }&categoryId="><s:property value="categoryName"/>全部</a>
		     </li>
		     <s:iterator value="#request.categoryListAll" id="id" status="status">   
		          <s:if test="#status.index<7">
					       <li>
					        <s:if test="keyword!=null">
					           <a href="user!groupbyUserPage.action?currentPage=1&userId=${userId }&categoryId=<s:property value="id"/>&keyword=<s:property value="keyword"/>"><s:property value="categoryName"/></a>
					        </s:if>
							<s:else>
							   <a href="user!groupbyUserPage.action?currentPage=1&userId=${userId }&categoryId=<s:property value="id"/>"><s:property value="categoryName"/></a>
							</s:else>
						   </li>
				   </s:if>
              </s:iterator>
		     </ul>
			 </div>
			 
			 
			 <div class="jiansuo_con">
			     <div class="jian">
			        <select id="sort" onchange="sort()">
			          <option value="">搜索方式</option>
			          <option value="price,desc">按价格由高到低</option>
			          <option value="price,asc">按价格由低到高</option>
			          <option value="endDate,desc">按时间由近及远</option>
			          <option value="endDate,asc">按时间由远及近</option>
			          <option value="discountPercent,desc">按折扣由高到低</option>
			          <option value="discountPercent,asc">按折扣由低到高</option>
			        </select>
			     </div>
			     <input type="hidden" id="url" value="user!groupbyUserPage?currentPage=1&userId=<s:property value="userId"/>&keyword="/><!-- 供tags使用 -->
			     <s:iterator value="#request.groupbyTodayListAll" id="id" status="status">
							<s:if test="#status.odd">
							     <div class="box">  
							       <div class="box_top"></div>
							          <div class="box_con">
										<div class="box_nei">
										<div class="t">
										   <span class="tag" id='tags<s:property value="#status.index"/>'></span>
										 </div>
										 <img src='<s:property value="#id[8]"/>' align='middle' class='img' />
										 <span style="background-color: #ffffff; font-size: 12px;">现价:<span
													class="teshu"><s:property value="#id[2].substring(0,#id[2].length()-2)"/>元</span>&nbsp;原价:<span class="teshu"><s:property value="#id[3].substring(0,#id[3].length()-2)"/>元</span>&nbsp;折扣:<span
													class="teshu"><s:property value="#id[4]"/></span>&nbsp;节省:<span class="teshu"><s:property value="#id[5].substring(0,#id[5].length()-2)"/>元</span>
												    
												     <input type="hidden" id="b<s:property value="#status.index"/>end" value='<s:property value="#id[9]"/>'/>
												    
												<br />剩余时间:<span class="teshu" id="b<s:property value="#status.index"/>"></span>
												</span>
										 <br/>
										 <s:if test="%{#id[1].length()>55}"> 
								                     <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1].substring(0,55)+'...'" /></span>
											     </s:if> 
											     <s:else>
											        <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1]" /></span>
											     </s:else>
										 <br/>
										 <table width="100%" border="0" align="center" cellpadding="0"
													cellspacing="0" class="table">
													<tr>
														<td align="center" valign="middle">
															<a href="javascript:void(0);" onclick="addTop(<s:property value="#id[0]"/>,this);"><img src="images/ding.jpg" align="bottom" /></a>
														</td>
														<td align="center" valign="middle">
															<s:property value="#id[6]"/>人
														</td>
														<td align="center" valign="middle">
															<a href="groupbyCriticism!criticismGroupby.action?groupbyId=<s:property value="#id[0]"/>&currentPage=1&cityId=${cityId}${categoryId}"><img src="images/pinglun.jpg" /></a>
														</td>
														<td align="center" valign="middle">
															<s:property value="#id[7]"/>人
														</td>
														<td align="center" valign="middle">
															<a href="<s:property value="#id[10]"/>" target="_blank"><img src="images/anniu.jpg" /></a>
														</td>
			
													</tr>
												</table>
								       </div>
										</div>
									    </div>
							</s:if>
							<s:if test="#status.even">
							    <div class="box1">  
								<div class="box_top"></div>
								<div class="box_con">
								<div class="box_nei"><div class="t">
								<span class="tag" id='tags<s:property value="#status.index"/>'>
								 </span>
								</div>
								<img src='<s:property value="#id[8]"/>' align='middle' class='img' />
								<span style="background-color: #ffffff; font-size: 12px;">现价:<span
													class="teshu"><s:property value="#id[2].substring(0,#id[2].length()-2)"/>元</span>&nbsp;原价:<span class="teshu"><s:property value="#id[3].substring(0,#id[3].length()-2)"/>元</span>&nbsp;折扣:<span
													class="teshu"><s:property value="#id[4]"/></span>&nbsp;节省:<span class="teshu"><s:property value="#id[5].substring(0,#id[5].length()-2)"/>元</span>
												    
												     <input type="hidden" id="b<s:property value="#status.index"/>end" value='<s:property value="#id[9]"/>'/>
												    
												<br />剩余时间:<span class="teshu" id="b<s:property value="#status.index"/>"></span>
												</span>
								 <br/>
								   <s:if test="%{#id[1].length()>55}"> 
								                     <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1].substring(0,55)+'...'" /></span>
											     </s:if> 
											     <s:else>
											        <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1]" /></span>
											     </s:else>
										
								 <br/>
								<table width="100%" border="0" align="center" cellpadding="0"
												cellspacing="0" class="table">
												<tr>
													<td align="center" valign="middle">
														<a href="javascript:void(0);" onclick="addTop(<s:property value="#id[0]"/>+',3',this);"><img src="images/ding.jpg" align="bottom" /></a>
													</td>
													<td align="center" valign="middle">
														<s:property value="#id[6]"/>人
													</td>
													<td align="center" valign="middle">
														<a href="groupbyCriticism!criticismGroupby.action?groupbyId=<s:property value="#id[0]"/>&currentPage=1&cityId=${cityId}${categoryId}"><img src="images/pinglun.jpg" /></a>
													</td>
													<td align="center" valign="middle">
														<s:property value="#id[7]"/>人
													</td>
													<td align="center" valign="middle">
														<a href="<s:property value="#id[10]"/>" target="_blank"><img src="images/anniu.jpg" /></a>
													</td>
		
												</tr>
											</table>
						</div>
								</div>
							    </div>
							</s:if>
				  </s:iterator>

			 </div>
		</div>
		
		
		<div class="ye">
		<s:if test="#request.groupbyTodayListAll.size()!=0">
		              <s:set name="paramStr">user!groupbyUserPage.action?userId=${userId }</s:set>
		              <s:if test="categoryId!=null">
		                <s:set name="paramStr" ><s:property value="paramStr"/>&categoryId=<s:property value="categoryId"/></s:set>
		              </s:if>
		              <s:if test="sort!=null">
		                <s:set name="paramStr" ><s:property value="paramStr"/>&sort=<s:property value="sort"/></s:set>
		              </s:if>
		              <s:if test="keyword!=null">
		                <s:set name="paramStr" ><s:property value="paramStr"/>&keyword=<s:property value="keyword" escape="false"/></s:set>
		              </s:if>

		                <s:set name="paramStr" ><s:property value="paramStr"/>&currentPage=</s:set>
		             
		              
							<a href="${paramStr}1">第一页</a>&nbsp;&nbsp;<a href="${paramStr}<s:property value="#request.pages.prePage"/>">上一页</a>
							  
							   <s:set name="totalPage" value="#request.pages.totalPage"></s:set>
							   
							   <s:set name="currentPage" value="#request.pages.currentPage"></s:set>
							   <s:if test="#currentPage<=0">
							      <s:set name="currentPage" value="1"></s:set>
							   </s:if>
							   <s:elseif test="#currentPage>#totalPage">
							      <s:set name="currentPage" value="#totalPage"></s:set>
							   </s:elseif>
							   
							   <s:if test="#totalPage%8>0">
							       <s:set name="pageSize" value="#totalPage/8+1"></s:set>
							   </s:if>
							   <s:else>
							       <s:set name="pageSize" value="#totalPage/8"></s:set>
							   </s:else>
							  
							   
							   <s:if test="#currentPage%8>0">
							       <s:set name="cPageSize" value="#currentPage/8+1"></s:set>
							   </s:if>
							   <s:else>
							       <s:set name="cPageSize" value="#currentPage/8"></s:set>
							   </s:else>
							   
							   <s:set name="first" value="8*(#cPageSize-1)"></s:set>
							   <s:if test="#first==0">
							      <s:set name="first" value="1"></s:set>
							   </s:if>
							   <s:set name="last" value="#cPageSize*8"></s:set>
							   <s:if test="#last>#totalPage">
							      <s:set name="last" value="#totalPage"></s:set>
							   </s:if>
				
							     <s:bean name="org.apache.struts2.util.Counter" id="counter"> 
							       <s:param name="first" value="#first"/>
							       <s:param name="last" value="#last" />
							       <s:iterator status="status"> 
							          
							         <s:if test="#currentPage==(#status.index+#first)">
							            &nbsp;&nbsp;<s:a href="%{paramStr}%{#status.index+#first}" cssStyle="background-color:#982987;color:#FFFFFF; padding-right:3px; padding-left:3px;" ><s:property value="#status.index+#first" /></s:a>
							         </s:if>
							         <s:else>
							            &nbsp;&nbsp;<s:a href="%{pageUrl}%{#status.index+#first}" ><s:property value="#status.index+#first" /></s:a>
							         </s:else>
							          
							       </s:iterator> 
							     </s:bean>
							     <s:if test="#last<#totalPage">
							       ......&nbsp;
							     </s:if>
							<a href="${paramStr}<s:property value="#request.pages.nextPage"/>">下一页</a>&nbsp;&nbsp;<a href="${paramStr}<s:property value="#request.pages.totalPage"/>">最后一页</a>
					        </s:if>
	   </div> 
		
		
		
         </div>
	  
	  
	  
	  
	<div class="right">
       
		<div  class="ba">
		      <div class="ba_top">
			  </div>
			   <div class="ba_con">
			   <div >
			       <s:if test="userDetial.image.equals('')">
				         <img src="uploadFile/img.gif" class="img4" width=270 height=184/>
				      </s:if>
				      <s:else>
				         <img src="uploadFile/<s:property value="userDetial.image"/>" class="img4" width=270 height=184/>
				      </s:else>
			   </div>
			   <div style="width:272px;">
			             <s:property value="userDetial.describale" escape="false"/>
			    </div>
			   <div style="margin-top:10px;">
			          <div class="guanzhu"><a href="javascript:void(0)" onclick="addFriend(<s:property value="userId"/>);">关注</a> 
			          <a style="padding-left:100px;"rect" href="groupbyCriticism!criticismGroupbyUser.action?userId=<s:property value="userId"/>" target="_parent">评价</a></div>
			          <div class="shouan">
			          
			               <div class="search">
							    <input type="text"   id="keyword"  class="input" name="keyword" value="我要搜索" />
							    <div class="label" id="for-keyword" onclick="search(13)"></div>
							</div>
				
			          </div>
			          
			   </div>
			   </div>
			   <div class="ba_bot">
			   </div>
		</div>
	    
		 <div class="notice">
		        <div class="box2_top"><a href="javascript:void(0);" target="_parent">关注我的人</a><span class="ziti_span">......................<a href="user/user!myFriendList.action?currentPage=1&userId=<s:property value="userId"/>" target="_parent" id="ziti_a">更多</a></span></div>
				<div class="box2_con">
				   <div class="not_nei">
				       <div class="hh1" style="overflow:hidden; text-overflow:ellipsis; width:300px;">
				      <s:iterator value="myFriendList" id="id" >
				            <s:if test="#id[0].level==2">
		                      <s:set name="url">user/user!singleUserPage.action?currentPage=1&userId=<s:property value="#id[0].id"/></s:set>
				           <div class="not1" style="height:82px;">
					        <div class="not_top">
					          <a href="<s:property value="url"/>">
						          <s:if test="#id[1].image.equals('')">
						            <img src="uploadFile/img.gif" width=60 height=60/>
							      </s:if>
							      <s:else>
							         <img src="uploadFile/<s:property value="#id[1].image"/>" width=60 height=60/>
							      </s:else>
						      </a>
						 </div>
						 <div class="not_con"><a  target="_parent"><s:property value="#id[1].username"/></a></div>
					   </div>
					    </s:if>
				      </s:iterator>
					 </div>
					 <div class="clear"></div>
					 </div>
				</div>
		 </div>
<div class="box2">
		      <div class="box2_top"><a  target="_parent">最新评论</a><span class="ziti_span"></span></div>
			  <div class="box2_con">
			  <ul class="ul2">
			      <s:iterator value="#request.groupbyCriticismList" id="id" status="status">
									   <s:set name="urlContent"><s:property value="#id[7]" escape="false"/></s:set>
									    <s:if test="#id[6]==2">
					                      <s:set name="url">user/user!singleUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:if>
									   <s:elseif test="#id[6]==3">
									      <s:set name="url">user/user!groupbyUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:elseif>
									   <s:elseif test="#id[6]==4">
									      <s:set name="url">user/user!brandUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:elseif>
								       <li>
										<div class="pic">
										   <a href="<s:property value="url"/>">
											<s:if test="#id[3].equals('')">
					                 			<img src="uploadFile/img.gif" width=60 height=60/>
								            </s:if>
								            <s:else>
								                 <img src="uploadFile/<s:property  value="#id[3]"/>" width=60 height=60/>
								            </s:else>
								            </a>
										</div>
										<div class="info">
											<div class="xin">
												<table width="100%" border="0" cellspacing="0"
													cellpadding="0">
													<tr>
														<td width="65%" align="left" valign="middle">
															&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[2]"/>:<a href="<s:property value="url"/>" class="ziti"><s:property value="#id[4]"/></a>
														</td>
														
													</tr>

												</table>

											</div>
											<a href="<s:property value="urlContent"/>">
											<s:if test="%{#id[1].length()>50}">
											    &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[1].substring(0,50)"/>...
											</s:if>
											<s:else>
											    &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[1]"/>
											</s:else>
											</a>
										</div>
										<!--end info-->
										<div class="clear"></div>
									  </li>
									 
								   </s:iterator>

		</div>
		
		
</div>
		
		
		
		<!---------------------end box2-------------------------------------------------------->
		
		
	  </div>
	 
	 <div class="clear"></div>
	  
	 
	  
    </div>
	
	  
</div>
<input type="hidden" id="legnth" value='<s:property value="#request.groupbyTodayListAll.size()"/>'/>

<div id="foot"><jsp:include page="../bot.jsp"></jsp:include></div>

</div>
</body>
</html>
 <script > 
  
  var legnth=$("#legnth").val();
  var tagsId=[];
  for(var i=0;i<legnth;i++)
  {
    tagsId.push("tags"+i+",t"+i);
    GetRTime("b"+i,"b"+i+"end");
  }
  lastIndexDemo(tagsId);
 </script>